{load header}
<!--/H-->
    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
                        <!-- nav -->
            

            
	<div class="main-title">
        <h2>{$act_t}规则</h2>
    </div>
    <form action="" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">规则名称<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="rule_name" maxlength="20" value="{$item['rule_name']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">满足数量<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="num" value="{$item['num']}">
            </div>
        </div>
        <div class="form-item" id="time_effect">

            <label class="item-label">规则作用时间<span class="check-tips"></span></label>
            <div class="controls" >
                <input type="text" class="text input-small" name="rule_start_time" value="{$item['rule_start_time']}" placeholder="比如9:00">----
                <input type="text" class="text input-small" name="rule_end_time" value="{$item['rule_end_time']}" placeholder="比如21:00">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">规则正反向选择<span class="check-tips"></span></label>
            <div class="controls">
                <select name="type">
                    <option value="1" {if $item['rule_direct']==1}selected{/if}>正向</option>
                    <option value="0" {if $item['rule_direct']==0}selected{/if}>反向</option>
                </select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">选择满足类型<span class="check-tips"></span></label>
            <div class="controls">
                <select name="type">
                    <option value="0">-请选择-</option>
                    <option value="1" {if $item['type']==1}selected{/if}>跳转</option>
                    <option value="2" {if $item['type']==2}selected{/if}>浏览</option>
                </select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">选择时间段类型<span class="check-tips"></span></label>
            <div class="controls">
                <select name="time_type" id="time_type_select" onchange="timetpyeChange();">
                    <option value="0">-请选择-</option>
                    <option value="1" {if $item['time_type']==1}selected{/if}>全天</option>
                    <option value="2" {if $item['time_type']==2}selected{/if}>多少时间内，比如120分钟</option>
                    <option value="3" {if $item['time_type']==3}selected{/if}>时间段，比如9:00--11:00</option>
                </select>
            </div>
        </div>

	


        <div class="form-item" id="time_value">
            {if $item['time_type']==2}
            <label class="item-label">时间段设置值（单位：分钟）<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="time_value" value="{$item['time_value']}" placeholder="数值以分钟为单位">
            </div>
            {/if}
            {if $item['time_type']==3}
            <label class="item-label">时间段设置（24小时制，比如09:00----21:00）<span class="check-tips"></span></label>
            <div class="controls" >
                <input type="text" class="text input-small" name="start_time" value="{$item['start_time']}" placeholder="比如9:00">----
                <input type="text" class="text input-small" name="end_time" value="{$item['end_time']}" placeholder="比如21:00">
            </div>
            {/if}
        </div>
        <div class="form-item">
            <label class="item-label">积分<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="score" value="{$item['score']}">
            </div>
        </div>
        <div class="form-item" >
            <label class="item-label">平台选择<span class="check-tips">（所有平台不用选择）</span></label>
            <div class="controls">
                <select name="plat_id[]" multiple="multiple" size="8">
                    <option value="">-请选择-</option>
                    {loop $all_plat $val}
                    <option value="{$val['id']}" {if $val['is_exists']==1}selected{/if}>{$val['name_ch']}</option>
                    {/loop}
                </select>
            </div>
        </div>
        <div class="form-item">
            <input   type="radio"   value="1"    name="is_valid"  {if $item['is_valid']==1 }checked{/if}/>有效
            <input   type="radio"   value="0"    name="is_valid"  {if $item['is_valid']==0 }checked{/if}/>无效
        </div>
        <div class="form-item">
            <label class="item-label">有效时间(单位：小时)<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="valid_hour" value="{$item['valid_hour']}" onkeyup="this.value=this.value.replace(/\D/g,'')">
            </div>
        </div>
        <input type="hidden" name="id" value="{$item['id']}"/>
        <div class="form-item">

            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>


    </form>
			</div>
	</div>
<script>
    function timetpyeChange() {
        time_type = $("#time_type_select").val();
        if(time_type==1){ //全天
            str = "";
        }else if(time_type==2){//多少时间内
            str = '<label class="item-label">时间段设置值（单位：分钟）<span class="check-tips"></span></label>' +
                    '<div class="controls">' +
                    '<input type="text" class="text input-large" name="time_value" value="" placeholder="数值以分钟为单位">' +
                    '</div>';
        }else if(time_type==3){//时间段
            str = '<label class="item-label">时间段设置（24小时制，比如09:00----21:00）<span class="check-tips"></span></label>' +
                    '<div class="controls" >' +
                    '<input type="text" class="text input-small" name="start_time" value="" placeholder="比如9:00">---- ' +
                    '<input type="text" class="text input-small" name="end_time" value="" placeholder="比如21:00"> ' +
                    '</div>';
        }
        $("#time_value").html(str);

    }
</script>
<!--F-->{load footer}